//
//  HQValanceEditCell.m
//  MobileiOS
//
//  Created by 郝庆松 on 2018/6/25.
//  Copyright © 2018年 PCITC. All rights reserved.
//

#import "HQValanceEditCell.h"

@implementation HQValanceEditCell

/**
 生成Cell
 
 @param tableView 列表
 @return ***
 */
+(instancetype)cellWithTableView:(UITableView*)tableView{
    static NSString *CellIdentifer = @"HQValanceEditCell";
    HQValanceEditCell *cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifer];
    if(!cell){
        [tableView registerNib:[UINib nibWithNibName:CellIdentifer bundle:nil] forCellReuseIdentifier:CellIdentifer];
        cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifer];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}

/**
 生成Cell
 
 @param tableView 列表
 @return ***
 */
+(instancetype)cellWithTableView:(UITableView*)tableView withIndexPath:(NSIndexPath *)indexPath{
    static NSString *CellIdentifer = @"HQValanceEditCell";
    HQValanceEditCell *cell = [tableView cellForRowAtIndexPath:indexPath];
    if(!cell){
        [tableView registerNib:[UINib nibWithNibName:CellIdentifer bundle:nil] forCellReuseIdentifier:CellIdentifer];
        cell = [tableView dequeueReusableCellWithIdentifier:CellIdentifer];
    }
    cell.selectionStyle = UITableViewCellSelectionStyleNone;
    return cell;
}


/**
 设置数据源
 
 @param dataInfo 数据源
 */
-(void)setDataInfo:(HQValanceModel *)dataInfo{
    _dataInfo = dataInfo;
    if([_dataInfo.isOpenHeSuan isEqualToString:@"YES"]){
        self.widthContraint.constant = 60;
    }else{
        self.widthContraint.constant = 0;
    }
    _deleteItem.dataInfo = _dataInfo;
    _zuJianItem.dataInfo = _dataInfo;
    _zuJianItem.className = self;
    [_v_name setTitle:_dataInfo.v_name forState:UIControlStateNormal];
    _v_num.text = _dataInfo.v_num;
    _v_unit.text = _dataInfo.v_unit;
    _v_artno.text = _dataInfo.v_artno;
    _v_price.text = _dataInfo.v_price;
}

@end
